gdk: Mark window surfaces as dirty before reading from them
authorBenjamin Otte <otte@redhat.com>
Fri, 18 Sep 2015 00:04:10 +0000 (02:04 +0200)
committerBenjamin Otte <otte@redhat.com>
Fri, 18 Sep 2015 00:06:01 +0000 (02:06 +0200)
We do not know what happened to this surface outside of GDK.
Especially for foreign windows, they will have been modified
by external applications.

So be on the safe side and tell Cairo to clear all its caches.

https://bugzilla.gnome.org/show_bug.cgi?id=754952

gdk/gdkpixbuf-drawable.c

index 9fabf872c93e3b520634e5dd810eb84678961e33..ae6e7dae8fa1f847d8cf73f23e6735079184f68f 100644 (file)
@@ -93,6 +93,14 @@ gdk_pixbuf_get_from_window (GdkWindow *src,
   g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
 
   surface = _gdk_window_ref_cairo_surface (src);
+
+  /* We do not know what happened to this surface outside of GDK.
+   * Especially for foreign windows, they will have been modified
+   * by external applications.
+   * So be on the safe side and:
+   */
+  cairo_surface_mark_dirty (surface);
+
   dest = gdk_pixbuf_get_from_surface (surface,
                                       src_x, src_y,
                                       width, height);